package com.wiim.ui;

import java.util.ArrayList;

import com.wiim.adapter.DanhSachAdapter;
import com.wiim.adapter.DoiThuongAdapter;
import com.wiim.model.DoithuongModel;
import com.wiim.nhapnhap.R;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

public class DoiThuongFragment extends Fragment {
	private ListView lvDoiThuong;
	private DoiThuongAdapter dataAdapter;
	ArrayList<DoithuongModel> listDoithuong = new ArrayList<DoithuongModel>();

	@Override
	public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.doithuong_list, container, false);
		initFeld(view);
		initData();
		return view;
	}

	private void initData() {
		for (int i = 0; i < 20; i++) {
			DoithuongModel doithuongModel = new DoithuongModel("Doi thuong" + i);
			listDoithuong.add(doithuongModel);
		}
		dataAdapter = new DoiThuongAdapter(getActivity(), listDoithuong);
		lvDoiThuong.setAdapter(dataAdapter);

	}

	private void initFeld(View view) {
		lvDoiThuong = (ListView) view.findViewById(R.id.lvDoiThuong);

	}

}
